package com.wisezone.HomeWork.home02;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        File file = new File("student.dat");
        try {
            InputStream inputStream = new FileInputStream(file);
            ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
            Object list = objectInputStream.readObject();
            if (list instanceof List)
            {
                List<Student> students = (List<Student>) list;
                for (Student s : students) {
                    System.out.println(s);
                }

            }
        } catch (Exception e) {
            e.printStackTrace();

        }
    }
}